package com.zhz.mall.common.util.listener;

import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.lang.NonNull;

/**
 * ApplicationStartedListenable
 * <p>
 * 项目启动完成监听器
 *
 * @author zhouhengzhe
 */
public interface ApplicationStartedListener extends ApplicationListener<ApplicationStartedEvent> {


    @Override
    default void onApplicationEvent(@NonNull ApplicationStartedEvent event) {
        onApplicationStarted();
        onApplicationStarted(event.getApplicationContext());
    }


    /**
     * 项目启动完成后触发
     */
    default void onApplicationStarted() {
    }


    /**
     * 项目启动完成后触发
     *
     * @param context 应用程序上下文
     */
    default void onApplicationStarted(ConfigurableApplicationContext context) {
    }


}
